package com.cn.api.service.impl; /**
 * @author: yihanyuan
 * @Description：
 * @Date: 2018/11/8 17:23
 */

import com.cn.api.service.SendMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

/**
 * @program: demo
 * @description:
 * @author: yihanyuan
 * @create: 2018-11-08 17:23
 **/
@Service("sendMailServiceImpl")
public class SendMailServiceImpl implements SendMailService {
    @Autowired
    JavaMailSender javaMailSender;

    @Override
    public void send(String emailAddress, String message) {
        SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
        simpleMailMessage.setText(message);
        simpleMailMessage.setTo(emailAddress);
        simpleMailMessage.setFrom("897124712@qq.com");
        simpleMailMessage.setSubject("测试一下");
        javaMailSender.send(simpleMailMessage);
    }
}
